package com.glsc.ngateway.common.base.domain.mysql.opmanagemain.outsys;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
import com.glsc.ngateway.common.api.common.enums.DictConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Where;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author liwei
 * 外部系统权限信息模板主表
 */
@Data
@Entity
@Table(name = "t_out_system_template")
@org.hibernate.annotations.Table(appliesTo = "t_out_system_template", comment = "外部系统权限信息模板表")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Where(clause = "deleted = 'N'")
public class OutSystemTemplate implements Serializable {

    private static final long serialVersionUID = -9168819246262366062L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Integer id;

    @ApiModelProperty(value = "模板名称")
    @Column(name = "name", columnDefinition = "varchar(100) COMMENT '模板名称'")
    private String name;

//    @ApiModelProperty(value = "系统名称")
//    @Column(name = "system_name", columnDefinition = "varchar(100) COMMENT '系统名称'")
//    private String systemName;
//
//    @Column(name = "sys_id", columnDefinition = "INT COMMENT '系统id'")
//    @ApiModelProperty(value = "系统id")
//    private Integer sysId;

    @ApiModelProperty(value = "岗位详细名称")
    @Column(name = "post_name", columnDefinition = "varchar(255) COMMENT '岗位详细名称'")
    private String postName;

    @ApiModelProperty(value = "备注")
    @Column(name = "memo", columnDefinition = "varchar(255) COMMENT '备注'")
    private String memo;

    @ApiModelProperty(value = "是否删除，字典 YesNo:（N=未删除(默认) Y=已删除)")
    @Column(name = "deleted", columnDefinition = "varchar(20) default 'N' COMMENT '是否删除，字典 yesno （N=否(默认) Y=是)'")
    private String deleted = DictConstant.NO;

    //创建时间
    @Column(name = "create_time", updatable = false)
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;


    @Transient
    private List<OutSystemTemplateRel> systemTemplateRelList;

}
